import Icon from "@ant-design/icons";
import { IconHome } from "./menuSvgs";

interface iconSvgMapType {
  // 索引签名允许任意字符串作为键
  [key: string]: () => JSX.Element;
}
// 图标映射
const iconSvgMap: iconSvgMapType = {
  "icon-home": IconHome
};

// 图标渲染
export const renderIcon = (icon: string) => {
  if (iconSvgMap[icon]) {
    return <Icon component={iconSvgMap[icon]}></Icon>;
  }
  return "";
};
